#!/usr/bin/python
import Entity
import pygame
import game_engine.GameEngine


# Representation of a door
class DoorEntity(Entity.Entity):


    # Obvious
    def __init__(self, name):
        super(DoorEntity, self).__init__(name)
        self.m_LevelManager = game_engine.GameEngine.getGameEngine().getLevelManager()
        self.m_Up = False


    # Called when an entity attempts to interact with this entity by bumping into it
    def interactBumped(self, otherEntity):
        if(otherEntity.getName() == "PLAYER"):
            newLevel = self.m_LevelManager.getCurrentLevel()
            if(self.m_Up):
                newLevel -= 1
            else:
                newLevel += 1

        self.m_LevelManager.loadLevel(newLevel)
        return False


